//
//  AmbitusDetailImageCell.m
//  TravelToHelp
//
//  Created by lanou3g on 15/10/30.
//  Copyright © 2015年 冯贵宾. All rights reserved.
//

#import "AmbitusDetailImageCell.h"

@interface AmbitusDetailImageCell ()

@property (nonatomic, strong) UIImageView *photoView;

@end

@implementation AmbitusDetailImageCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)  {
        self.photoView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 100)];
        [self.contentView addSubview:self.photoView];
        
    }
    return self;
}


- (void)setModel:(AmbitusDetailModel *)model
{
   
    NSMutableArray *size = [NSMutableArray arrayWithArray:model.size];
 
    
        if (size.count > 0) {
         
            CGFloat scale = [size[0] integerValue] / kScreenWidth;
            CGFloat newHeight = [size[1] integerValue] / scale;
            self.photoView.frame = CGRectMake(0, 0, kScreenWidth, newHeight);
            [self.photoView sd_setImageWithURL:[NSURL URLWithString:model.content] placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
        }
    
   
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
